you are confusing the fact your stock goes up with the mechanics and actual benefit of the dividend .
dividends have to lower the share price , it is mandatory....... that does not mean your stock does not go up... you are confusing issues . follow carefully here so you can be one of the few who actually get it .
1000 shares of a 100 dollar stock is 100k invested . lets pretend it pays 4% , so it is MANDATORY by the exchanges that it is to to be reduced when it goes ex div so they drop your value automatically ... so you get 4k and have 96k left for markets to work on . ... now the markets act on 96k which is made up of your 1000 shares at 96 bucks when the bell rings and you have 4k in pocket as a return of investment in that dividend . ..
so you give them back the 4k and buy 41.666 shares effectively returning the same 4k back to them albeit construed differently .... now you have 1041.666 shares at 96 a share which is the exact same 100k you had before it went ex div . it is just arraigned differently .
so lets suppose the market doubled your stock ...so your 1041.666 shares at 96 a share worth 100k grew to 200k if you reinvested , which if you notice is the same as the 100k you were at before it went ex div. in both cases it is the same 100k that had doubled . but if you did not reinvest the dividend you would have had only 96k left for the markets to double so you would only have 192k if you kept the dividend .. see how that works .
your stock went up from whatever you paid for it originally to 100k in value . they gave you back 4k of it , knocked your value to 96k by reducing the price automatically before it can trade , you then hand them back the 4k and say no thanks , keep it invested , so they buy you 4k in more shares at the lowered price and you have the same 100k you had the night before it went ex div .... they merely handed you a piece of your gain back and you returned it .
pre div you had 100k and 1000 shares at 100 a share equaling 100k , after the div and reinvestment you have 1041.666 shares at 96 a share worth the same 100k . markets open and go up 100% , you picked a fabulous stock and it soared . in both cases you have the same exact 200k ...
no different than a portfolio of non div stocks ... if you have a portfolio of non div payers worth 100k and you take out 4% you have the same 96k left and 4k in hand . if your stocks double you have the same 192k left and 4k in hand ,,, if you reinvest the 4k back in you have the same 200k .
both the dividend payers and non payers are both redistributing the exact same gains ... it is not how many shares you have that make up those dollars , it is the total dollars you have that is compounded on . that is why a stock split is a wash .
you can learn more about how it works here
https://finance.zacks.com/dont-investors-buy-stock-just-before-dividend-date-then-sell-9577.html
https://www.investopedia.com/ask/answers/buy-before-dividend-then-sell/