R. Hershel Schachter in his Be'Ikvei HaTzon cites Bekhorot 3b as proof that one is not allowed to exempt himself from a mitzvah:
רב מרי בר רחל הו"ל ההיא חיותא, הוה מקנה לאודנייהו לעובד כוכבים ואסר
להו בגיזה ועבודה ויהיב להו לכהנים, וכלאי חיותא דרב מרי בר רחל, וכו'
משום דמפקע להו מקדושתייהו
R. Mari b. Rahel possessed a herd of animals. He used to transfer [to a heathen] possession of the ears [of the firstlings while still in the womb]... The herd of R. Mari b. Rahel died... Because he deprived them of their holiness.
However, others note that this case may be different because:
One is subverting the sanctity of the animal, not only exempting oneself from a mitzvah; perhaps only subversion of sanctity is problematic.
According to one opinion in the Gemara, R. Mari was only punished because others who were ignorant of the relevant laws would learn from his example, but otherwise one would be allowed to exempt himself from a mitzvah (see R. Tzvi Pesach Frank, Har Tzvi al HaTorah, Ki Tisa; compare Maharsha cited above).
It would seem reasonable that this question is also related to the Gemara in Menachot 41a (and indeed R. Schachter cites this Gemara as well).
Another passage that relates to this question is Berakhot 35b:
ואמר רבה בר בר חנה אמר רבי יוחנן משום רבי יהודה ברבי אלעאי: בא וראה
שלא כדורות הראשונים דורות האחרונים; דורות הראשונים היו מכניסין
פירותיהן דרך טרקסמון - כדי לחייבן במעשר, דורות האחרונים מכניסין
פירותיהן דרך גגות דרך חצרות דרך קרפיפות - כדי לפטרן מן המעשר; דאמר רבי
ינאי: אין הטבל מתחייב במעשר עד שיראה פני הבית
Rabbah b. Bar Hanah further said in the name of R. Johanan reporting
R. Judah b. Ila'i: Observe the difference between the earlier and the
later generations. The earlier generations used to bring in their
produce by way of the kitchen-garden purposely in order to make it
liable to tithe, whereas the later generations bring in their produce
by way of roofs or courtyards or enclosures in order to make it exempt
from tithe. For R. Jannai has said: Untithed produce is not subject to
tithing until it has come within sight of the house, since it says.
I have put away the hallowed things out of my house. R. Johanan,
however, says that even [sight of] a courtyard imposes the obligation,
as it says, That they may eat within thy gates and be satisfied.
This Gemara seems to imply that it is a discredit to the later generations that they avoided the obligation. R. Kook in his Ein Ayah (on the Gemara in Berakhot) comments:
ההבדל שיש בין המכיר ערך המצות ותכליתן הנשגבה וחפץ בהן באמת ובין מי
שעבודתו היא רק מצות אנשים מלומדה הוכן להיות יוצא אל הפועל בהרבה מצות
מן התורה, שנמצאו בהם דרכים ע"פ דין תורה להפקיע החיוב מעצמו. אמנם רק
בזה יוודע שלימות העובד מאהבה, בהיות לאל ידו לפטור עצמו ובהיותו מכיר את
ערך המצוה וקדושתה הוא נכנס להתחייב בה. ע"כ במצות מעשרות, שהיא המצוה
הראשית המחזקת את כל אושר הכלל כולו, בהיותה לברית בין המיוחדים לעבודת
ד' שבט הלוי ובין כל העם כולו, דאגה החכמה האלהית ביותר שתהי' נעשיח ע"פ
רוח נדיבה המכרת את ערכה הגדול. ע"כ נתנה מקום להחלץ ממנה [ע"י] הכנסה
דרך גגות חצירו' וקרפיפות, למען שתגיע הרגשת העושה לעשות המצוה מיקרת רוח
ונפש נדיבה, שבזה תצא אל הפועל תכליתה להשלים את הכלל כולו כחפץ האדון
השם יתברך.
See also here for a discussion of הערמה; and see Pesachim 48b:
אמר רב יוסף הני נשי דידן נהוג למיפא קפיזא קפיזא [רש"י: שלשת לוגין לחומרא לשומרו מן החימוץ] לפיסחא. א"ל אביי מאי דעתיך לחומרא? חומרא דאתי לידי קולא הוא, דקא מפקע לה מחלה; and see R. Gershon Zaks' commentary to Bekhorot 57b.